package com.dylan.job.config;

import com.dylan.job.executor.JobExecutor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConfigurationProperties(prefix = "dylan.job.executor")
public class JobConfig {

    private Integer port;

    @Bean
    public JobExecutor jobExecutor() {
        JobExecutor jobExecutor = new JobExecutor();
        jobExecutor.setPort(port);
        jobExecutor.start();
        return jobExecutor;
    }
}
